<template>
  <div class="pages gradesList">
    <div class="pageLevel" v-if="!sub">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="待录入" name="first">
          <div class="tableSearch">
            <el-form size="small" label-width="70px">
              <el-form-item label-width="70px" label="报名时间">
                <el-date-picker
                  format="yyyy-MM-dd"
                  v-model="selectdata[0].timer"
                  size="small"
                  value-format="yyyy-MM-dd"
                  unlink-panels
                  type="daterange"
                  range-separator="-"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  clearable
                ></el-date-picker>
              </el-form-item>
              <el-form-item label-width="70px" label="手机号码">
                <el-input type="text" v-model="selectdata[0].phone" placeholder="手机号码"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="报名姓名">
                <el-input type="text" v-model="selectdata[0].name" placeholder="报名姓名"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="身份证号">
                <el-input type="text" v-model="selectdata[0].idNumber" placeholder="身份证号"></el-input>
              </el-form-item>
              <el-form-item label label-width="20px">
                <el-button type="primary" @click="searchSelect(0)">查询</el-button>
                <el-button @click="reset(0)">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <el-table
            :data="tableData[0].list"
            size="medium"
            tooltip-effect="dark"
            style="width: 100%"
          >
            <el-table-column prop="index" width="50" label="序号"></el-table-column>
            <el-table-column prop="name" width="150" align="center" label="报名姓名"></el-table-column>
            <el-table-column prop="idNumber" align="center" width="200" label="身份证号"></el-table-column>
            <el-table-column prop="phone" width="200" align="center" label="手机号码"></el-table-column>
            <el-table-column :formatter="certType" prop="ticketState" align="center" label="考试内容"></el-table-column>
            <el-table-column prop="registeTime" align="center" width="100" label="报名时间"></el-table-column>
            <el-table-column align="center" width="200" fixed="right" label="操作">
              <template slot-scope="scope">
                <el-button type="text" @click="addAccount(scope.row,0)">学习账号</el-button>
                <el-button type="text" @click="cellClick(scope.row.id,scope.row)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <page-unit :pageData="pageData[0]" :func="getcouponList"></page-unit>
          <!-- tab1弹窗 -->
          <el-dialog title="录入学习账号" @close="closeall" center :visible.sync="tabDialog[0].bool">
            <el-form :model="tab_1_dialogData" ref="tab_1_dialogData" :rules="rules">
              <el-form-item label="姓名" :label-width="formLabelWidth">
                <div>{{tab_1_dialogData.name}}</div>
              </el-form-item>
              <el-form-item label="身份证号" :label-width="formLabelWidth">
                <div>{{tab_1_dialogData.idNumber}}</div>
              </el-form-item>
              <el-form-item label="学习账号" :label-width="formLabelWidth" prop="account">
                <el-input v-model="tab_1_dialogData.account" autocomplete="off"></el-input>
              </el-form-item>
              <el-form-item label="账号密码" :label-width="formLabelWidth" prop="password">
                <el-input v-model="tab_1_dialogData.password" autocomplete="off"></el-input>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="tabDialog[0].bool = false">取 消</el-button>
              <el-button
                type="primary"
                @click="submitForm('tab_1_dialogData',tab_1_dialogData,0)"
              >确 定</el-button>
            </span>
          </el-dialog>
        </el-tab-pane>
        <el-tab-pane label="待录成绩" name="second">
          <div class="tableSearch">
            <el-form size="small" label-width="70px">
              <el-form-item label-width="70px" label="报名时间">
                <el-date-picker
                  format="yyyy-MM-dd"
                  v-model="selectdata[1].timer"
                  size="small"
                  value-format="yyyy-MM-dd"
                  unlink-panels
                  type="daterange"
                  range-separator="-"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  clearable
                ></el-date-picker>
              </el-form-item>
              <el-form-item label-width="70px" label="手机号码">
                <el-input type="text" v-model="selectdata[1].phone" placeholder="手机号码"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="报名姓名">
                <el-input type="text" v-model="selectdata[1].name" placeholder="报名姓名"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="身份证号">
                <el-input type="text" v-model="selectdata[1].idNumber" placeholder="身份证号"></el-input>
              </el-form-item>
              <el-form-item label label-width="20px">
                <el-button type="primary" @click="searchSelect(1)">查询</el-button>
                <el-button @click="reset(1)">重置</el-button>
                <el-button type="primary" @click="second">录入补考成绩</el-button>
              </el-form-item>
            </el-form>
          </div>
          <el-table
            :data="tableData[1].list"
            size="medium"
            tooltip-effect="dark"
            style="width: 100%"
          >
            <el-table-column prop="index" width="50" label="序号"></el-table-column>
            <el-table-column prop="name" width="150" align="center" label="报名姓名"></el-table-column>
            <el-table-column prop="idNumber" align="center" width="200" label="身份证号"></el-table-column>
            <el-table-column prop="phone" width="200" align="center" label="手机号码"></el-table-column>
            <el-table-column :formatter="certType" prop="ticketState" align="center" label="考试内容"></el-table-column>
            <el-table-column prop="registeTime" align="center" label="报名时间"></el-table-column>
            <el-table-column prop="account" align="center" label="学习账号"></el-table-column>
            <el-table-column prop="password" align="center" label="学习密码"></el-table-column>
            <el-table-column align="center" width="200" fixed="right" label="操作">
              <template slot-scope="scope">
                <el-button type="text" @click="addgra(scope.row,1)">录入成绩</el-button>
                <el-button type="text" @click="cellClick(scope.row.id,scope.row)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <page-unit :pageData="pageData[1]" :func="getcouponList"></page-unit>
          <!-- tab2弹窗 -->
          <el-dialog title="录入成绩" @close="closeall" center :visible.sync="tabDialog[1].bool">
            <el-form :model="tab_2_dialogData" ref="tab_2_dialogData" :rules="rules">
              <el-form-item label="姓名" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.name}}</div>
              </el-form-item>
              <el-form-item label="手机号码" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.phone}}</div>
              </el-form-item>
              <el-form-item label="身份证号" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.idNumber}}</div>
              </el-form-item>
              <el-form-item label="考试成绩" :label-width="formLabelWidth" prop="account">
                <el-select v-model="tab_2_dialogData.examScore" placeholder="请选择">
                  <el-option
                    v-for="item in examScoreOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="tabDialog[1].bool = false">取 消</el-button>
              <el-button
                type="primary"
                @click="submitForm('tab_2_dialogData',tab_2_dialogData,1)"
              >确 定</el-button>
            </span>
          </el-dialog>
          <!-- tab2补考成绩弹窗 -->
          <el-dialog title="录入补考成绩" @close="closeall" center :visible.sync="secondDio">
            <div class="tableSearch">
              <el-form size="small" label-width="70px">
                <el-form-item label-width="70px" label="报名时间">
                  <el-date-picker
                    format="yyyy-MM-dd"
                    v-model="secondDioData.timer"
                    size="small"
                    value-format="yyyy-MM-dd"
                    unlink-panels
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始时间"
                    end-placeholder="结束时间"
                    clearable
                  ></el-date-picker>
                </el-form-item>
                <el-form-item label-width="70px" label="手机号码">
                  <el-input type="text" v-model="secondDioData.phone" placeholder="手机号码"></el-input>
                </el-form-item>
                <el-form-item label-width="70px" label="报名姓名">
                  <el-input type="text" v-model="secondDioData.name" placeholder="报名姓名"></el-input>
                </el-form-item>
                <el-form-item label-width="70px" label="身份证号">
                  <el-input type="text" v-model="secondDioData.idNumber" placeholder="身份证号"></el-input>
                </el-form-item>
                <el-form-item label label-width="20px">
                  <el-button type="primary" @click="searchsecondDio()">查询</el-button>
                  <el-button @click="resetsecond(1)">重置</el-button>
                </el-form-item>
              </el-form>
            </div>
            <el-form :model="tab_2_dialogData" ref="tab_2_dialogData" :rules="rules">
              <el-form-item label="姓名" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.name}}</div>
              </el-form-item>
              <el-form-item label="手机号码" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.phone}}</div>
              </el-form-item>
              <el-form-item label="身份证号" :label-width="formLabelWidth">
                <div>{{tab_2_dialogData.idNumber}}</div>
              </el-form-item>
              <el-form-item label="考试成绩" :label-width="formLabelWidth">
                <el-select v-model="tab_2_dialogData.examScore" placeholder="请选择">
                  <el-option
                    v-for="item in examScoreOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="close">取 消</el-button>
              <el-button
                type="primary"
                :disabled="needDta"
                @click="submitForm('tab_2_dialogData',tab_2_dialogData,1)"
              >确 定</el-button>
            </span>
          </el-dialog>
        </el-tab-pane>
        <el-tab-pane label="待寄证书" name="third">
          <div class="tableSearch">
            <el-form size="small" label-width="70px">
              <el-form-item label-width="70px" label="手机号码">
                <el-input type="text" v-model="selectdata[2].phone" placeholder="手机号码"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="报名姓名">
                <el-input type="text" v-model="selectdata[2].name" placeholder="报名姓名"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="身份证号">
                <el-input type="text" v-model="selectdata[2].idNumber" placeholder="身份证号"></el-input>
              </el-form-item>
              <el-form-item label label-width="20px">
                <el-button type="primary" @click="searchSelect(2)">查询</el-button>
                <el-button @click="reset(2)">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <el-table
            :data="tableData[2].list"
            size="medium"
            tooltip-effect="dark"
            style="width: 100%"
          >
            <el-table-column prop="index" width="50" label="序号"></el-table-column>
            <el-table-column prop="name" width="150" align="center" label="报名姓名"></el-table-column>
            <el-table-column prop="idNumber" align="center" width="200" label="身份证号"></el-table-column>
            <el-table-column prop="phone" width="200" align="center" label="手机号码"></el-table-column>
            <el-table-column :formatter="certType" prop="ticketState" align="center" label="考试内容"></el-table-column>
            <el-table-column prop="address" label="地址"></el-table-column>
            <el-table-column align="center" width="200" fixed="right" label="操作">
              <template slot-scope="scope">
                <el-button type="text" @click="cellClick(scope.row.id,scope.row)">查看</el-button>
                <el-button type="text" @click="addNumber(scope.row,2)">邮寄证书</el-button>
              </template>
            </el-table-column>
          </el-table>
          <page-unit :pageData="pageData[2]" :func="getcouponList"></page-unit>
          <!-- tab3弹窗 -->
          <el-dialog title="邮寄证书" @close="closeall" center :visible.sync="tabDialog[2].bool">
            <el-form :model="tab_3_dialogData" ref="tab_3_dialogData" :rules="rules">
              <el-form-item label="姓名" :label-width="formLabelWidth">
                <div>{{tab_3_dialogData.name}}</div>
              </el-form-item>
              <el-form-item label="手机号码" :label-width="formLabelWidth">
                <div>{{tab_3_dialogData.phone}}</div>
              </el-form-item>
              <el-form-item label="身份证号" :label-width="formLabelWidth">
                <div>{{tab_3_dialogData.idNumber}}</div>
              </el-form-item>
              <el-form-item label="物流公司" :label-width="formLabelWidth" prop="logisticsCompany">
                <el-select v-model="tab_3_dialogData.logisticsCompany" placeholder="请选择">
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="快递单号" :label-width="formLabelWidth" prop="trackNumber">
                <el-input v-model="tab_3_dialogData.trackNumber" autocomplete="off"></el-input>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="tabDialog[2].bool = false">取 消</el-button>
              <el-button
                type="primary"
                @click="submitForm('tab_3_dialogData',tab_3_dialogData,2)"
              >确 定</el-button>
            </span>
          </el-dialog>
        </el-tab-pane>
        <el-tab-pane label="已寄证书" name="fourth">
          <div class="tableSearch">
            <el-form size="small" label-width="70px">
              <el-form-item label-width="70px" label="手机号码">
                <el-input type="text" v-model="selectdata[3].phone" placeholder="手机号码"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="报名姓名">
                <el-input type="text" v-model="selectdata[3].name" placeholder="报名姓名"></el-input>
              </el-form-item>
              <el-form-item label-width="70px" label="身份证号">
                <el-input type="text" v-model="selectdata[3].idNumber" placeholder="身份证号"></el-input>
              </el-form-item>
              <el-form-item label label-width="20px">
                <el-button type="primary" @click="searchSelect(3)">查询</el-button>
                <el-button @click="reset(3)">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <el-table
            :data="tableData[3].list"
            size="medium"
            tooltip-effect="dark"
            style="width: 100%"
          >
            <el-table-column prop="index" width="50" label="序号"></el-table-column>
            <el-table-column prop="name" width="150" align="center" label="报名姓名"></el-table-column>
            <el-table-column prop="idNumber" align="center" width="200" label="身份证号"></el-table-column>
            <el-table-column prop="phone" width="200" align="center" label="手机号码"></el-table-column>
            <el-table-column :formatter="certType" prop="ticketState" align="center" label="考试内容"></el-table-column>
            <el-table-column prop="address" label="地址"></el-table-column>
            <el-table-column prop="logisticsCompany" label="物流公司"></el-table-column>
            <el-table-column prop="trackNumber" label="物流单号"></el-table-column>
            <el-table-column align="center" width="200" fixed="right" label="操作">
              <template slot-scope="scope">
                <el-button type="text" @click="cellClick(scope.row.id,scope.row)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <page-unit :pageData="pageData[3]" :func="getcouponList"></page-unit>
        </el-tab-pane>
      </el-tabs>
    </div>
    <div class="pageLevel" v-else>
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
import { mapState } from "vuex";
import pageUnit from "@/components/Page";
import state from "@/util/state";
import util from "@/util";
import dateClass from "@/util/date.js";
const date = new dateClass();
import { trainRegisteLIst, registerEdit, supplementaryExamScore } from "@/api";
export default {
  data() {
    return {
      examScoreOptions: [
        {
          value: "0",
          label: "不合格"
        },
        {
          value: "1",
          label: "合格"
        }
      ],
      options: [
        {
          value: "0",
          label: "顺丰速运"
        },
        {
          value: "1",
          label: "中通快递"
        },
        {
          value: "2",
          label: "圆通快递"
        },
        {
          value: "3",
          label: "申通快递"
        },
        {
          value: "4",
          label: "韵达速运"
        },
        {
          value: "5",
          label: "EMS"
        },
        {
          value: "6",
          label: "天天快递"
        },
        {
          value: "7",
          label: "百世快递"
        }
      ],
      needDta: true,
      tabDialog: [{ bool: false }, { bool: false }, { bool: false }],
      secondDio: false, //补考成绩弹窗
      secondDioData: {
        //补考弹窗搜索
        name: "",
        idNumber: "",
        phone: "",
        timer: []
      },
      tab_1_dialogData: {
        registerId: "",
        name: "",
        idNumber: "",
        account: "",
        password: ""
      },
      tab_2_dialogData: {
        registerId: "",
        name: "",
        idNumber: "",
        examScore: "1"
      },
      tab_3_dialogData: {
        registerId: "",
        name: "",
        idNumber: "",
        logisticsCompany: "",
        trackNumber: ""
      },
      rules: {
        account: [
          { required: true, message: "请输入学习账号", trigger: "blur" },
          { max: 200, message: "长度小于200个字符", trigger: "blur" }
        ],
        password: [
          { required: true, message: "请输入密码", trigger: "blur" },
          { max: 200, message: "长度小于200个字符", trigger: "blur" }
        ],
        trackNumber: [
          { required: true, message: "请输入物流单号", trigger: "blur" },
          { max: 50, message: "长度小于50个字符", trigger: "blur" },
          { validator: util.abcNum, trigger: "blur" }
        ],
        logisticsCompany: [
          { required: true, message: "请选择物流公司", trigger: "change" }
        ]
      },
      formLabelWidth: "120px",
      activeName: "first",
      certType: state.certType,
      selectdata: [
        {
          name: "",
          idNumber: "",
          phone: "",
          timer: []
        },
        {
          name: "",
          idNumber: "",
          phone: "",
          timer: []
        },
        {
          name: "",
          idNumber: "",
          phone: "",
          timer: []
        },
        {
          name: "",
          idNumber: "",
          phone: "",
          timer: []
        }
      ],
      pageData: [
        {
          pageSize: 20,
          currentPage: 1,
          totalItems: 0,
          pageSizeArr: [5, 10, 20]
        },
        {
          pageSize: 20,
          currentPage: 1,
          totalItems: 0,
          pageSizeArr: [5, 10, 20]
        },
        {
          pageSize: 20,
          currentPage: 1,
          totalItems: 0,
          pageSizeArr: [5, 10, 20]
        },
        {
          pageSize: 20,
          currentPage: 1,
          totalItems: 0,
          pageSizeArr: [5, 10, 20]
        }
      ],
      tableData: [{ list: [] }, { list: [] }, { list: [] }, { list: [] }],
      tabNum: 0,
      status: 1
    };
  },
  components: { pageUnit },
  computed: mapState(["merchantId", "sub", "power"]),
  watch: {
    sub: {
      handler: function(val, oldVal) {
        if (oldVal != null && val == false) {
          this.tabNum =
            this.activeName == "first"
              ? 0
              : this.activeName == "second"
              ? 1
              : this.activeName == "third"
              ? 2
              : this.activeName == "fourth"
              ? 3
              : 0;
          this.status =
            this.tabNum == 0
              ? 1
              : this.tabNum == 1
              ? 3
              : this.tabNum == 2
              ? 4
              : this.tabNum == 3
              ? 5
              : 5;
          this.getcouponList();
        }
      },
      deep: true
    }
  },
  mounted() {
    this.getcouponList();
  },
  methods: {
    //tab\切换
    handleClick(tab) {
      this.tabNum = tab.index;
      this.status =
        tab.index == 0
          ? 1
          : tab.index == 1
          ? 3
          : tab.index == 2
          ? 4
          : tab.index == 3
          ? 5
          : 5;
      this.getcouponList();
    },
    //搜索
    searchSelect(tab) {
      this.pageData[tab].currentPage = 1;
      this.status =
        tab == 0 ? 1 : tab == 1 ? 3 : tab == 2 ? 4 : tab == 3 ? 5 : 5;
      this.getcouponList();
    },
    //成绩列表
    getcouponList() {
      let data = {
        source: 1, //来源 0-报名列表 1-报名管理 2-成绩列表
        shopId: this.merchantId,
        pageSize: this.pageData[this.tabNum].pageSize,
        pageNo: this.pageData[this.tabNum].currentPage,
        status: this.status, //状态 0-待审核 1-审核通过（待录入） 2-审核不通过（审核失败）3-待录成绩 4-待寄证书 5-已寄证书多个类型用逗号隔开）
        certificateType: 0 //报名类型:0-母婴照护指导
      };
      let registeStartTime = "";
      let registeEndTime = "";
      if (
        this.selectdata[this.tabNum].timer == [] ||
        this.selectdata[this.tabNum].timer == null
      ) {
        registeStartTime = "";
        registeEndTime = "";
      } else {
        if (this.selectdata[this.tabNum].timer.length == 0) {
          registeStartTime = "";
          registeEndTime = "";
        } else {
          registeStartTime =
            this.selectdata[this.tabNum].timer[0] + " 00:00:00";
          registeEndTime = this.selectdata[this.tabNum].timer[1] + " 23:59:59";
        }
      }
      let selectData = {
        name: this.selectdata[this.tabNum].name,
        idNumber: this.selectdata[this.tabNum].idNumber,
        phone: this.selectdata[this.tabNum].phone,
        registeStartTime: registeStartTime, //报名开始时间
        registeEndTime: registeEndTime //报名结束时间
      };
      Object.assign(data, selectData);
      trainRegisteLIst(data).then(res => {
        res.data.list.forEach((ele, index) => {
          ele.index =
            index +
            1 +
            (this.pageData[this.tabNum].currentPage - 1) *
              this.pageData[this.tabNum].pageSize;
          ele.registeTime = date.timestampToTimes(ele.registeTime);
          if (ele.logisticsCompany != null) {
            ele.logisticsCompany = this.options[ele.logisticsCompany].label;
          }
        });
        this.tableData[this.tabNum].list = res.data.list;
        this.pageData[this.tabNum].totalItems = res.data.total;
        // this.pageData.currentPage = pageNum;
      });
    },
    //Tab1重置
    reset(tab) {
      this.selectdata[tab].name = "";
      this.selectdata[tab].idNumber = "";
      this.selectdata[tab].phone = "";
      this.selectdata[tab].timer = [];
    },
    resetsecond() {
      this.secondDioData = {
        //补考弹窗搜索
        name: "",
        idNumber: "",
        phone: "",
        timer: []
      };
    },
    //tab1打开弹窗
    addAccount(row, tab) {
      this.tabDialog[0].bool = true;
      this.tab_1_dialogData = row;
    },
    //tab2打开弹窗
    addgra(row, tab) {
      this.tab_2_dialogData = row;
      this.tab_2_dialogData.examScore = "1";
      this.tabDialog[1].bool = true;
    },
    //tab3打开弹窗
    addNumber(row, tab) {
      this.tab_3_dialogData = row;
      this.tabDialog[tab].bool = true;
    },
    //弹窗提交
    submitForm(formName, data, tab) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          let st =
            data.status == 1
              ? 3
              : data.status == 3
              ? 4
              : data.status == 4
              ? 5
              : data.status == 5
              ? 5
              : "";
          if (data.status == 3 && data.examScore == 0) {
            st = 3;
          }

          let setData = {
            id: data.id,
            status: st,
            account: data.account,
            password: data.password,
            logisticsCompany: data.logisticsCompany,
            trackNumber: data.trackNumber,
            examScore: data.examScore
          };
          if (data.status == 4) {
            delete setData.examScore;
          }

          registerEdit(setData).then(res => {
            if (res.code == 200) {
              this.$message({
                message: res.msg,
                type: "success"
              });
              this.tabDialog[this.tabNum].bool = false;
              this.secondDio = false;
              this.needDta = false;
              this.status =
                this.tabNum == 0
                  ? 1
                  : this.tabNum == 1
                  ? 3
                  : this.tabNum == 2
                  ? 4
                  : this.tabNum == 3
                  ? 5
                  : 5;
              this.pageData[this.tabNum].pageNum = 1;
              this.getcouponList();

              this.tab_1_dialogData = {
                registerId: "",
                name: "",
                idNumber: "",
                account: "",
                password: ""
              };
              this.tab_2_dialogData = {
                registerId: "",
                name: "",
                idNumber: "",
                examScore: "1"
              };
              this.tab_3_dialogData = {
                registerId: "",
                name: "",
                idNumber: "",
                logisticsCompany: "",
                trackNumber: ""
              };
            }
          });
        } else {
          return false;
        }
      });
    },
    //跳转
    cellClick(id,row) {
      util.routerTo("/training-center/reManagement/relist/reDetails", {
        id: id,
        row:row
      });
    },
    second() {
      this.secondDio = true;
    },
    //搜索补考成绩
    searchsecondDio() {
      let registeStartTime = "";
      let registeEndTime = "";
      if (this.secondDioData.timer == [] || this.secondDioData.timer == null) {
        registeStartTime = "";
        registeEndTime = "";
      } else {
        if (this.secondDioData.timer.length == 0) {
          registeStartTime = "";
          registeEndTime = "";
        } else {
          registeStartTime = this.secondDioData.timer[0] + " 00:00:00";
          registeEndTime = this.secondDioData.timer[1] + " 23:59:59";
        }
      }
      let selectData = {
        shopId: this.merchantId,
        status: 3, //状态 0-待审核 1-审核通过（待录入） 2-审核不通过（审核失败）3-待录成绩 4-待寄证书 5-已寄证书多个类型用逗号隔开）
        certificateType: 0, //报名类型:0-母婴照护指导
        name: this.secondDioData.name,
        idNumber: this.secondDioData.idNumber,
        phone: this.secondDioData.phone,
        registeStartTime: registeStartTime, //报名开始时间
        registeEndTime: registeEndTime //报名结束时间
      };
      supplementaryExamScore(selectData).then(res => {
        if (res.data.list.length > 1) {
          this.$message({
            message: "请添加更多搜索条件",
            type: "error"
          });
        } else if (res.data.list.length == 0) {
          this.$message({
            message: "暂无数据",
            type: "error"
          });
        } else {
          this.needDta = false;
          this.tab_2_dialogData = res.data.list[0];
          this.tab_2_dialogData.examScore = "1";
        }
      });
    },
    close() {
      this.secondDio = false;
    },
    closeall() {
      this.tab_1_dialogData = {
        registerId: "",
        name: "",
        idNumber: "",
        account: "",
        password: ""
      };
      this.tab_2_dialogData = {
        registerId: "",
        name: "",
        idNumber: "",
        examScore: "1"
      };
      this.tab_3_dialogData = {
        registerId: "",
        name: "",
        idNumber: "",
        logisticsCompany: "",
        trackNumber: ""
      };
    }
  }
};
</script>
<style scoped>
.pageLevel {
  background: #fff;
  padding: 10px;
  margin-top: 10px;
}
</style>